package com.wlw.layoutmanager.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.wlw.layoutmanager.R;
import com.wlw.layoutmanager.adapters.SkidRightAdapter;
import com.wlw.layoutmanager.beans.SkidRightBean;
import com.wlw.layoutmanager.layoutManager.SkidRightLayoutManager;

import java.util.ArrayList;
import java.util.List;

import me.imid.swipebacklayout.lib.app.SwipeBackActivity;

public class SkidRightActivity extends SwipeBackActivity {
    private RecyclerView mRecyclerView;
    private SkidRightLayoutManager mSkidRightLayoutManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_skid_right);
        initView();
    }

    private void initView() {
        mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        mSkidRightLayoutManager = new SkidRightLayoutManager(1.5f, 0.85f);
        mRecyclerView.setLayoutManager(mSkidRightLayoutManager);
        mRecyclerView.setAdapter(new SkidRightAdapter(getData()));
    }

    private List<SkidRightBean> getData() {
        int[] imgs = {
                R.mipmap.skid_right_1,
                R.mipmap.skid_right_2,
                R.mipmap.skid_right_3,
                R.mipmap.skid_right_4,
                R.mipmap.skid_right_5,
                R.mipmap.skid_right_6,
                R.mipmap.skid_right_7,
        };
        String[] titles = {"Acknowl", "Belief", "Confidence", "Dreaming", "Happiness", "Confidence"};
        List<SkidRightBean> data = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            data.add(new SkidRightBean(titles[i % 6], imgs[i % 6]));
        }
        return data;
    }
}
